package com.dkd.manage.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.dkd.common.annotation.Log;
import com.dkd.common.core.controller.BaseController;
import com.dkd.common.core.domain.AjaxResult;
import com.dkd.common.enums.BusinessType;
import com.dkd.manage.domain.ZcglDsjZcps1;
import com.dkd.manage.service.IZcglDsjZcps1Service;
import com.dkd.common.utils.poi.ExcelUtil;
import com.dkd.common.core.page.TableDataInfo;

/**
 * 数据一Controller
 * 
 * @author ruoyi
 * @date 2025-02-15
 */
@RestController
@RequestMapping("/manage/DataOne")
public class ZcglDsjZcps1Controller extends BaseController
{
    @Autowired
    private IZcglDsjZcps1Service zcglDsjZcps1Service;

    /**
     * 查询数据一列表
     */
    @PreAuthorize("@ss.hasPermi('manage:DataOne:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZcglDsjZcps1 zcglDsjZcps1)
    {
        startPage();
        List<ZcglDsjZcps1> list = zcglDsjZcps1Service.selectZcglDsjZcps1List(zcglDsjZcps1);
        return getDataTable(list);
    }

    /**
     * 导出数据一列表
     */
    @PreAuthorize("@ss.hasPermi('manage:DataOne:export')")
    @Log(title = "数据一", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZcglDsjZcps1 zcglDsjZcps1)
    {
        List<ZcglDsjZcps1> list = zcglDsjZcps1Service.selectZcglDsjZcps1List(zcglDsjZcps1);
        ExcelUtil<ZcglDsjZcps1> util = new ExcelUtil<ZcglDsjZcps1>(ZcglDsjZcps1.class);
        util.exportExcel(response, list, "数据一数据");
    }

    /**
     * 获取数据一详细信息
     */
    @PreAuthorize("@ss.hasPermi('manage:DataOne:query')")
    @GetMapping(value = "/{XZQYDM}")
    public AjaxResult getInfo(@PathVariable("XZQYDM") String XZQYDM)
    {
        return success(zcglDsjZcps1Service.selectZcglDsjZcps1ByXZQYDM(XZQYDM));
    }

    /**
     * 新增数据一
     */
    @PreAuthorize("@ss.hasPermi('manage:DataOne:add')")
    @Log(title = "数据一", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZcglDsjZcps1 zcglDsjZcps1)
    {
        return toAjax(zcglDsjZcps1Service.insertZcglDsjZcps1(zcglDsjZcps1));
    }

    /**
     * 修改数据一
     */
    @PreAuthorize("@ss.hasPermi('manage:DataOne:edit')")
    @Log(title = "数据一", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZcglDsjZcps1 zcglDsjZcps1)
    {
        return toAjax(zcglDsjZcps1Service.updateZcglDsjZcps1(zcglDsjZcps1));
    }

    /**
     * 删除数据一
     */
    @PreAuthorize("@ss.hasPermi('manage:DataOne:remove')")
    @Log(title = "数据一", businessType = BusinessType.DELETE)
	@DeleteMapping("/{XZQYDMs}")
    public AjaxResult remove(@PathVariable String[] XZQYDMs)
    {
        return toAjax(zcglDsjZcps1Service.deleteZcglDsjZcps1ByXZQYDMs(XZQYDMs));
    }
}
